from google.appengine.ext import webapp

from django.template.defaultfilters import stringfilter

register = webapp.template.create_template_register()

def trunc(value, size):
    if value:
        if len(value) > size:
            return value[:(size-3)] + '...'
        else:
            return value[:size]
    return value
register.filter(trunc)

